package 日期;

import javafx.scene.effect.Light;

import java.util.Calendar;
import java.util.Scanner;

public class 日历demo {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int year =sc.nextInt();//年
        int mo = sc.nextInt();//月
        Calendar calendar = Calendar.getInstance();//日历对象
        int ia = 1;
        calendar.set(year,mo,0);
        int max = calendar.get(Calendar.DAY_OF_MONTH);
        calendar.set(year,mo-1,1);
        int firstday = calendar.get(Calendar.DAY_OF_WEEK);
        System.out.println("日\t一\t二\t三\t四\t五\t六");
        for (int i = -firstday;i<max;i++){
            if (i<0) System.out.print("  \t");

        }
    }
}
